home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Cosmo Software 1997 May
/
SGI Cosmo Software 1997 May.iso
/
dist
/
dmedia_eoe.idb
/
usr
/
include
/
sys
/
hdsp.h.z
/
hdsp.h
Wrap
C/C++ Source or Header
|
1997-05-23
|
11KB
|
289 lines
#ifndef __HDSP_H__
#define __HDSP_H__
/**************************************************************************
* *
* Copyright (C) 1988, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
#ident "$Revision: 1.39 $"
/**************************************************************************
*
* hdsp.h - High fidelity DSP device driver programmer visible structs.
*
**************************************************************************/
/*
* ring buffer header
*/
typedef struct rbheader_s
{
long head; /* index of buffer head location */
long tail; /* index of buffer tail location */
long intreq; /* */
long fillpt; /* buffer fill point */
}rbheader_t;
#define RBHEADER_SIZE (sizeof(rbheader_t)/sizeof(long))
/*
* ioctl cases
*/
#define HDSP_RESET 0
#define HDSP_ACTIVATE 1
#define HDSP_FIND_MINOR 2
#define HDSP_ACQUIRE_AUDIO_RB 3
#define HDSP_SET_AUDIO_PARMS 4
#define HDSP_GET_AUDIO_PARMS 5
#define HDSP_GET_HRBSTATUS 6
#define HDSP_SET_HRBSTATUS 7
#define HDSP_SET_RB_INFO 8
#define HDSP_GET_ALL_RB_INFO 9
#define HDSP_SET_RB_TYPE 10
#define HDSP_GET_RB_MSC 11
#define HDSP_FLUSH 12
#define HDSP_PORTCTRL 13
#define HDSP_QUERYPARAMS 14
#define HDSP_GET_MINMAX 15
#define HDSP_GET_NAME 16
#define HDSP_GET_DEFAULT 17
#define HDSP_ACQUIRE_DIRECT_AUDIO_RB 18
#define HDSP_GET_RB_USTMSC 19
#ifndef HRB_STRLEN
#define HRB_STRLEN 20 /* max length of HRB/port name */
#endif
/*
* arg struct for HDSP_ACQUIRE_AUDIO_RB ioctl
*/
typedef struct hdsp_acquireaudiorb_s
{
int nlocs; /* Number of locations in the user's virtual space. */
char direction; /* TOMIPS or FROMMIPS */
} hdsp_acquireaudiorb_t;
/*
* arg struct for HDSP_SET_RB_INFO ioctl
*/
typedef struct hdsp_setrbinfo_s
{
char name[HRB_STRLEN]; /* name of HRB/port */
int version; /* AL version number */
} hdsp_setrbinfo_t;
/*
* arg struct for HDSP_GET_RBINFO ioctl
*/
typedef struct hdsp_getrbinfo_s
{
char name[HRB_STRLEN]; /* name of HRB/port */
int pid; /* pid of process associated with port */
int type; /* TOMIPS or FROMMIPS */
int rbid; /* internal id associated with RB */
int version; /* AL version */
int errcnt; /* error count for the RB */
int nchans; /* number of channels in RB */
int head; /* head of RB */
int tail; /* tail of RB */
int nlocs; /* number of locations in RB */
} hdsp_getrbinfo_t;
/*
* arg struct for HDSP_GET_RBSTATUS and HDSP_SET_RBSTATUS
*/
typedef struct hdsp_rbstatus_s
{
long error; /* ring buffer error count */
long type; /* the type of error */
long length; /* the length of the error (in samples) */
long location[2]; /* location (in samples) of the beginning of */
/* the error. location[0] is the low 24 bits, and */
/* location[1] is the high 24 bits of a 48-bit count*/
} hdsp_rbstatus_t;
typedef struct hdsp_rbmsc_s
{
/* These are taken atomically */
unsigned long long msc; /* MSC at kernel side of ring-buffer */
unsigned int head, tail; /* HRB head and tail values */
unsigned long long ust; /* Unadjusted System Time */
} hdsp_rbmsc_t;
/*
* ioctl parameter subcodes
* same subcodes used for both set and get of parameters
* buffer looks like an array of longs: [len, subcode,value, subcode,
* value, ...]
* values are read on sets and filled in on gets
*
* make sure corresponding parameters in audio.h and hdsp.h agree
*
* IF YOU ADD ANY PARAMETERS, YOU MAY NEED TO UPDATE MAX_AUDIO_PARMS_LEN
* YOU MAY ALSO NEED TO UPDATE AL_MAX_PBUFSIZE, in audio.h. These two
* parameters should be the same, and large enough to hold all the
* parms and associated values.
*/
#define HDSP_MAX_AUDIO_PARMS_LEN 64
#define HDSP_INPUT_SOURCE 0
#define HDSP_LEFT_INPUT_ATTEN 1
#define HDSP_RIGHT_INPUT_ATTEN 2
#define HDSP_LEFT1_INPUT_ATTEN 1 /* Same as HDSP_LEFT_INPUT_ATTEN */
#define HDSP_RIGHT1_INPUT_ATTEN 2 /* Same as HDSP_LEFT_INPUT_ATTEN */
#define HDSP_INPUT_RATE 3
#define HDSP_OUTPUT_RATE 4
#define HDSP_LEFT_SPEAKER_GAIN 5
#define HDSP_RIGHT_SPEAKER_GAIN 6
#define HDSP_INPUT_RBCOUNT 7
#define HDSP_OUTPUT_RBCOUNT 8
#define HDSP_UNUSED_RBCOUNT 9
#define HDSP_MONITOR_CTL 12
#define HDSP_LEFT_MONITOR_ATTEN 13
#define HDSP_RIGHT_MONITOR_ATTEN 14
#define HDSP_CHANNEL_MODE 15
#define HDSP_SPEAKER_MUTE_CTL 16
#define HDSP_MIC_MODE 17
#define HDSP_LEFT2_INPUT_ATTEN 18
#define HDSP_RIGHT2_INPUT_ATTEN 19
#define HDSP_DIGITAL_INPUT_RATE 20
#define HDSP_LOCK_STATE 21
#define HDSP_RANGE_VALUE 2
#define HDSP_ENUM_VALUE 1
/*
* support for dormant ports
*/
#define HDSP_DEACTIVATE_PORT 0
#define HDSP_ACTIVATE_PORT 1
/*
* current ring-buffer types
*/
#define HDSP_MONO 1
#define HDSP_STEREO 2
#define HDSP_4CHANNEL 4
/*
* available rates, in Hz, 44100 == 44.1KHz,
* 5333_33 == 5.33333 KHz etc
* The _ALT entries are different hardware
* configurations that achieve the same rate
* NOTE: these rates are implementation dependent
* 44.1, and 48 are the least likely to change
* You have been warned
*/
#define HDSP_C_RATE(x) ((x)<<1)
#define HDSP_M_RATE(x) ((x)<<2)
#define HDSP_S_RATE(x) ((x)<<4)
#define HDSP_RATE_48000 (HDSP_M_RATE(0)|HDSP_C_RATE(0)|HDSP_S_RATE(0))
#define HDSP_RATE_44100 (HDSP_M_RATE(1)|HDSP_C_RATE(0)|HDSP_S_RATE(0))
#define HDSP_RATE_32000 (HDSP_M_RATE(0)|HDSP_C_RATE(1)|HDSP_S_RATE(0))
#define HDSP_RATE_29400 (HDSP_M_RATE(1)|HDSP_C_RATE(1)|HDSP_S_RATE(0))
#define HDSP_RATE_24000 (HDSP_M_RATE(0)|HDSP_C_RATE(0)|HDSP_S_RATE(1))
#define HDSP_RATE_22050 (HDSP_M_RATE(1)|HDSP_C_RATE(0)|HDSP_S_RATE(1))
#define HDSP_RATE_16000 (HDSP_M_RATE(0)|HDSP_C_RATE(0)|HDSP_S_RATE(2))
#define HDSP_RATE_16000_ALT (HDSP_M_RATE(0)|HDSP_C_RATE(1)|HDSP_S_RATE(1))
#define HDSP_RATE_14700 (HDSP_M_RATE(1)|HDSP_C_RATE(0)|HDSP_S_RATE(2))
#define HDSP_RATE_14700_ALT (HDSP_M_RATE(1)|HDSP_C_RATE(1)|HDSP_S_RATE(1))
#define HDSP_RATE_12000 (HDSP_M_RATE(0)|HDSP_C_RATE(0)|HDSP_S_RATE(3))
#define HDSP_RATE_11025 (HDSP_M_RATE(1)|HDSP_C_RATE(0)|HDSP_S_RATE(3))
#define HDSP_RATE_10666_7 (HDSP_M_RATE(0)|HDSP_C_RATE(1)|HDSP_S_RATE(2))
#define HDSP_RATE_9800 (HDSP_M_RATE(1)|HDSP_C_RATE(1)|HDSP_S_RATE(2))
#define HDSP_RATE_9600 (HDSP_M_RATE(0)|HDSP_C_RATE(0)|HDSP_S_RATE(4))
#define HDSP_RATE_8820 (HDSP_M_RATE(1)|HDSP_C_RATE(0)|HDSP_S_RATE(4))
#define HDSP_RATE_8000 (HDSP_M_RATE(0)|HDSP_C_RATE(0)|HDSP_S_RATE(5))
#define HDSP_RATE_8000_ALT (HDSP_M_RATE(0)|HDSP_C_RATE(1)|HDSP_S_RATE(3))
#define HDSP_RATE_7350 (HDSP_M_RATE(1)|HDSP_C_RATE(0)|HDSP_S_RATE(5))
#define HDSP_RATE_7350_ALT (HDSP_M_RATE(1)|HDSP_C_RATE(1)|HDSP_S_RATE(3))
#define HDSP_RATE_6857_14 (HDSP_M_RATE(0)|HDSP_C_RATE(0)|HDSP_S_RATE(6))
#define HDSP_RATE_6400 (HDSP_M_RATE(0)|HDSP_C_RATE(1)|HDSP_S_RATE(4))
#define HDSP_RATE_6300 (HDSP_M_RATE(1)|HDSP_C_RATE(0)|HDSP_S_RATE(6))
#define HDSP_RATE_6000 (HDSP_M_RATE(0)|HDSP_C_RATE(0)|HDSP_S_RATE(7))
#define HDSP_RATE_5880 (HDSP_M_RATE(1)|HDSP_C_RATE(1)|HDSP_S_RATE(4))
#define HDSP_RATE_5512_5 (HDSP_M_RATE(1)|HDSP_C_RATE(0)|HDSP_S_RATE(7))
#define HDSP_RATE_5333_33 (HDSP_M_RATE(0)|HDSP_C_RATE(1)|HDSP_S_RATE(5))
#define HDSP_RATE_4900 (HDSP_M_RATE(1)|HDSP_C_RATE(1)|HDSP_S_RATE(5))
#define HDSP_RATE_4571_43 (HDSP_M_RATE(0)|HDSP_C_RATE(1)|HDSP_S_RATE(6))
#define HDSP_RATE_4200 (HDSP_M_RATE(1)|HDSP_C_RATE(1)|HDSP_S_RATE(6))
#define HDSP_RATE_4000 (HDSP_M_RATE(0)|HDSP_C_RATE(1)|HDSP_S_RATE(7))
#define HDSP_RATE_3675 (HDSP_M_RATE(1)|HDSP_C_RATE(1)|HDSP_S_RATE(7))
/*
* these set the rate to be the AES input rate divided by n, n = 1..8
*/
#define HDSP_RATE_AES_1 (HDSP_M_RATE(3)|HDSP_C_RATE(0)|HDSP_S_RATE(0))
#define HDSP_RATE_AES_2 (HDSP_M_RATE(3)|HDSP_C_RATE(0)|HDSP_S_RATE(1))
#define HDSP_RATE_AES_3 (HDSP_M_RATE(3)|HDSP_C_RATE(0)|HDSP_S_RATE(2))
#define HDSP_RATE_AES_4 (HDSP_M_RATE(3)|HDSP_C_RATE(0)|HDSP_S_RATE(3))
#define HDSP_RATE_AES_5 (HDSP_M_RATE(3)|HDSP_C_RATE(0)|HDSP_S_RATE(4))
#define HDSP_RATE_AES_6 (HDSP_M_RATE(3)|HDSP_C_RATE(0)|HDSP_S_RATE(5))
#define HDSP_RATE_AES_7 (HDSP_M_RATE(3)|HDSP_C_RATE(0)|HDSP_S_RATE(6))
#define HDSP_RATE_AES_8 (HDSP_M_RATE(3)|HDSP_C_RATE(0)|HDSP_S_RATE(7))
/*
* as above with a scale factor of s == 2/3
*/
#define HDSP_RATE_AES_1s (HDSP_M_RATE(3)|HDSP_C_RATE(1)|HDSP_S_RATE(0))
#define HDSP_RATE_AES_2s (HDSP_M_RATE(3)|HDSP_C_RATE(1)|HDSP_S_RATE(1))
#define HDSP_RATE_AES_3s (HDSP_M_RATE(3)|HDSP_C_RATE(1)|HDSP_S_RATE(2))
#define HDSP_RATE_AES_4s (HDSP_M_RATE(3)|HDSP_C_RATE(1)|HDSP_S_RATE(3))
#define HDSP_RATE_AES_5s (HDSP_M_RATE(3)|HDSP_C_RATE(1)|HDSP_S_RATE(4))
#define HDSP_RATE_AES_6s (HDSP_M_RATE(3)|HDSP_C_RATE(1)|HDSP_S_RATE(5))
#define HDSP_RATE_AES_7s (HDSP_M_RATE(3)|HDSP_C_RATE(1)|HDSP_S_RATE(6))
#define HDSP_RATE_AES_8s (HDSP_M_RATE(3)|HDSP_C_RATE(1)|HDSP_S_RATE(7))
#define HDSP_RATE_INPUTRATE 1 /* output rate tracks input rate */
#define HDSP_RATE_UNDEFINED (-1) /* rate read is not defined by spec */
#define HDSP_RATE_NO_DIGITAL_INPUT (-2) /* AESRX PLL not yet locked.*/
#define HDSP_RATE_UNACQUIRED (-3) /* PLL locked but rate not read yet */
/*
* Definition of some AES rate bits
*/
#define HDSP_NONAUDIO_CONSUMER_RATE_44100 0
#define HDSP_NONAUDIO_CONSUMER_RATE_UNDEFINED 1
#define HDSP_NONAUDIO_CONSUMER_RATE_48000 2
#define HDSP_NONAUDIO_CONSUMER_RATE_32000 3
/*
* These are the available input sources
*/
#define HDSP_INPUT_LINE 0 /* Line In Jack */
#define HDSP_INPUT_MIC 1 /* Microphone Jack */
#define HDSP_INPUT_DIGITAL 2 /* Digital I/O Jack */
/*
* The following defines indicate the type of a host ring buffer.
*/
#define HRB_TOMIPS 0 /*data transfer to mips */
#define HRB_FROMMIPS 1 /*data transfer from mips */
#define HRB_FOLDED 2 /*dsp (24b,24b) pair <-> mips 32b word*/
#define HRB_UNFOLDED 0 /*dsp 24b word <-> mips 32b word */
#define HRB_EXTEND 4 /*sign extension */
#define HRB_NOEXTEND 0 /*no sign extension */
#ifdef _KERNEL
#define HRB_USERSPACE 8 /*memory mapped to user space */
#define HRB_KERNELSPACE 0 /*memory mapped to kernel space */
#define HRB_SPLIT 0x10 /*rb has split header/buffer */
#define HRB_NODEFER 0x20 /*don't defer update of head/tail ptr */
#define HRB_MASTER 0x40 /*ring buffer is a rate master */
#define HRB_DIRECT 0x80 /*direct rb*/
#define HRB_SERIAL 0 /*serial access rb*/
#define HRB_DORMANT 0x100 /*dormant RB */
#define HRB_NOTALLOCED 0x200 /* RB mem not alloced by kerncreate */
#endif /*_KERNEL*/
/*
* maximum ring buffer length in bytes
*/
#define MAXRBLEN (4096*256)
#endif /* __HDSP_H__ */